import { Injectable } from '@angular/core';
import { ProductService, Product } from './product.service';
import { LoggerService } from './logger.service';

@Injectable({
  providedIn: 'root'
})
export class AnotherProductService implements ProductService {

  GetProducts(): Product[] {
    var prods = [];
    for (var i = 0; i < 20; i++) {
      prods.push(new Product(i + 1, `iphoneX v${i}`, `iphoneX v${i}最新款`, 200 * i + 2000, "http://placehold.it/320X150", 0.5 * i + 1.5));
    }
    this._logger.Log(`获取商品${prods.length}个`);
    return prods;
  }
  constructor(public _logger: LoggerService) { }
}
